#include "Producer.h"
#include "taskQueue.h"
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <thread>
#include <chrono>
using namespace std;

void Producer::produce(TaskQueue &taskQue)
{
    // 种随机种子
    srand(time(NULL));

    // 产生随机数
    int cnt = 20;
    while (cnt--)
    {
        int number = rand() % 100;
        taskQue.push(number);
        cout << ">>Producer produce = " << number << " | " << "sizeof(taskQue) =" << taskQue.size() << endl;
        this_thread::sleep_for(chrono::milliseconds(500));
    }
}